home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / mindos11.zip / MRDBLK.C < prev    next >
C/C++ Source or Header  |  1991-03-22  |  965b  |  37 lines

  1. /*  mrdblk.c        -- read a block from a Minix file system */
  2. /*  Copyright 1988,1991 Steven W. Harrold - All rights reserved. */
  3. /*  $Header: MRDBLK.C_V 1.5 91/03/20 09:46:24 SWH Exp $ */
  4.  
  5. #include    <stdio.h>
  6. #include    <dos.h>
  7. #include    "mfs.h"
  8. #include    "dev.h"
  9.  
  10. DEVREAD
  11.  
  12.  
  13. /*==================================================================*/
  14. void read_block (buf, blkno, ddata)
  15. void            *buf ;              /* input buffer */
  16. int             blkno ;             /* first block is # 0 */
  17. struct devdata  *ddata ;
  18. {
  19.     int     sb, sect ;
  20.  
  21.     sb = BLOCK_SIZE / SECTOR_SIZE ;
  22.     sect = blkno * sb ;
  23.  
  24.     Dstatus = devread (ddata, sb, sect, buf) ;
  25.     if (Dstatus)
  26.     {
  27.         fprintf(stderr, "Can't read drive %c: at block %d, ",
  28.                         DRIVES[ddata->d_drive], blkno) ;
  29.         fprintf(stderr, "Status code = %d\n", Dstatus) ;
  30.         exit (2) ;
  31.     }
  32.  
  33. } /* read_block() */
  34.  
  35.  
  36. /*---eof---*/
  37.